﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdBrEdgeLoopTraverser : OdBrTraverser
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdBrEdgeLoopTraverser(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdBrEdgeLoopTraverser_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdBrEdgeLoopTraverser obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdBrEdgeLoopTraverser()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdBrEdgeLoopTraverser(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdBrErrorStatus setEdge(OdBrEdge edge)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEdgeLoopTraverser_setEdge(this.swigCPtr, OdBrEdge.getCPtr(edge));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setLoop(OdBrLoop loop)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEdgeLoopTraverser_setLoop(this.swigCPtr, OdBrLoop.getCPtr(loop));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setEdgeAndLoop(OdBrLoopEdgeTraverser loopEdge)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEdgeLoopTraverser_setEdgeAndLoop(this.swigCPtr, OdBrLoopEdgeTraverser.getCPtr(loopEdge));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrLoop getLoop()
		{
			OdBrLoop result = new OdBrLoop(GlobalsPINVOKE.OdBrEdgeLoopTraverser_getLoop(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrEdge getEdge()
		{
			OdBrEdge result = new OdBrEdge(GlobalsPINVOKE.OdBrEdgeLoopTraverser_getEdge(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrEdgeLoopTraverser() : this(GlobalsPINVOKE.new_OdBrEdgeLoopTraverser(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
